<?php

namespace common\models\base;

use Yii;

/**
 * This is the model class for table "{{%che300_car_model}}".
 *
 * @property int $id
 * @property int $model_id
 * @property int $series_id
 * @property int $brand_id
 * @property int $ext_model_id
 * @property string $series_group_name
 * @property string $color
 * @property string $model_liter
 * @property string $model_year
 * @property string $brand_name
 * @property string $model_name
 * @property string $model_price
 * @property string $model_emission_standard
 * @property string $model_gear
 * @property string $series_name
 * @property string $min_reg_year
 * @property string $max_reg_year
 *
 * @property Che300CmVinBind[] $che300CmVinBinds
 */
class Che300CarModel extends \yii\db\ActiveRecord
{
    /**
     * {@inheritdoc}
     */
    public static function tableName()
    {
        return '{{%che300_car_model}}';
    }

    /**
     * {@inheritdoc}
     */
    public function rules()
    {
        return [
            [['model_id', 'series_id', 'brand_id', 'ext_model_id', 'brand_name', 'model_name', 'series_name'], 'required'],
            [['model_id', 'series_id', 'brand_id', 'ext_model_id'], 'integer'],
            [['model_price'], 'number'],
            [['series_group_name', 'color', 'brand_name', 'model_name', 'series_name'], 'string', 'max' => 150],
            [['model_liter', 'model_year', 'model_emission_standard', 'model_gear', 'min_reg_year', 'max_reg_year'], 'string', 'max' => 20],
            [['model_id'], 'unique'],
        ];
    }

    /**
     * {@inheritdoc}
     */
    public function attributeLabels()
    {
        return [
            'id' => Yii::t('app', 'ID'),
            'model_id' => Yii::t('app', 'Model ID'),
            'series_id' => Yii::t('app', 'Series ID'),
            'brand_id' => Yii::t('app', 'Brand ID'),
            'ext_model_id' => Yii::t('app', 'Ext Model ID'),
            'series_group_name' => Yii::t('app', 'Series Group Name'),
            'color' => Yii::t('app', 'Color'),
            'model_liter' => Yii::t('app', 'Model Liter'),
            'model_year' => Yii::t('app', 'Model Year'),
            'brand_name' => Yii::t('app', 'Brand Name'),
            'model_name' => Yii::t('app', 'Model Name'),
            'model_price' => Yii::t('app', 'Model Price'),
            'model_emission_standard' => Yii::t('app', 'Model Emission Standard'),
            'model_gear' => Yii::t('app', 'Model Gear'),
            'series_name' => Yii::t('app', 'Series Name'),
            'min_reg_year' => Yii::t('app', 'Min Reg Year'),
            'max_reg_year' => Yii::t('app', 'Max Reg Year'),
        ];
    }

    /**
     * @return \yii\db\ActiveQuery
     */
    public function getChe300CmVinBinds()
    {
        return $this->hasMany(Che300CmVinBind::className(), ['che300_model_id' => 'model_id']);
    }
}
